package com.parenting.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.parenting.response.FeedbackImgVO;
import com.parenting.response.FeedbackVO;
import com.parenting.sevice.FeedbackService;
import com.parenting.util.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 * 意见反馈 前端控制器
 * </p>
 *
 * @author zcj
 * @since 2021-05-26
 */
@RestController
@Api(tags = "意见反馈通知")
@RequestMapping("/plaza/feedback")
public class FeedbackController {

    @Autowired
    private FeedbackService feedbackService;


    @ApiOperation(value = "意见反馈列表(后台管理员)")
    @GetMapping("/list/{current}/{size}")
    public Result<Page<FeedbackVO>> pageList(@ApiParam(name = "current", value = "页码", required = true)
                                               @PathVariable("current") @NotNull(message = "页码不能为空") Integer current,
                                             @ApiParam(name = "size", value = "每页显示多少条", required = true)
                                               @PathVariable("size") @NotNull(message = "每页显示多少条不能为空") Integer size) {
        return feedbackService.pageList(current, size);
    }

    @ApiOperation(value = "意见反馈图片列表(后台管理员)")
    @GetMapping("/list/{id}")
    public Result<List<FeedbackImgVO>> imgList(@ApiParam(name = "id", value = "意见反馈id", required = true)
                                                 @PathVariable("id") @NotNull(message = "id") Integer id) {
        return feedbackService.imgList(id);
    }
}

